from selenium import webdriver
from selenium.webdriver.common.keys import Keys
import time
import  json

username=input("username:")
passwd=input("passwd:")



driver = webdriver.Chrome()
driver.get("http://jp.ops.net")  #打开浏览器
time.sleep(3)

driver.find_element("name","username").click()
driver.find_element("name","username").send_keys(username)
driver.find_element("name","password").send_keys(passwd)
driver.find_element("name","password").send_keys(Keys.ENTER)

cookies = driver.get_cookies()
print (type(cookies))

for i in cookies:
    print(i)

f1 = open('cookie.txt', 'w')
f1.write(json.dumps(cookies))
f1.close

driver.close()

## cookie可以用个Google浏览器导出